home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 002 / wsindex.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1984-04-24  |  2.9 KB  |  71 lines

  1. 10  REM   WSINDEX.BAS
  2. 20  '
  3. 30  ' WORDSTAR INDEXING PROGRAM.  5/28/83    Version 1.0
  4. 40  ' Purpose:   Display (while in Wordstar) a list of text files with a short
  5. 50  '            description of their contents.
  6. 60  '
  7. 70  ' Operating Instructions:
  8. 80  '    I. Adding a description to Wordstar Files
  9. 90  '            The very first line in each of your Wordstar text files should
  10. 100  '            be a comment line (begins with two periods).  This line is
  11. 110  '            displayed as a description of your file.  The following format
  12. 120  '            is recommended but not required: ".. mm/dd/yy xxxxxxxxxxx"
  13. 130  '            The two periods cause Wordstar to ignore the line.  When displayed
  14. 140  '            this program will show the creation date and a short description.
  15. 150  '           This program assumes that your Wordstar files have
  16. 160  '           a file type of "TXT" or "   " (blank extension).
  17. 170  '
  18. 180   '   II. Obtaining File Descriptions under Wordstar
  19. 190  '            A. Make sure your default disk (either A: or B: as is your custom)
  20. 200  '               has this program as well as BASICA.COM
  21. 210  '            B. From the initial Wordstar Menu, select the "R"un command
  22. 220  '            C. Type "BASICA WSINDEX" as the program to run
  23. 230  '               Follow the displayed instructions.
  24. 240  '
  25. 250  '
  26. 260  DIM D$(120)                 'list of file names (120 is max # possible)
  27. 265  CLS:PRINT
  28. 270  FILES :PRINT:PRINT          'easiest way to get names into BASIC
  29. 280  PRINT "Wait a minute while I read all of these file names"
  30. 290  I=2: J=1: N=0: A$=""        'put Wordstar names into D$ array
  31. 300  WHILE SCREEN(I,J)<>0 AND J<78 AND SCREEN(I,J)<>32
  32. 310      A$=""
  33. 320       FOR K=0 TO 11
  34. 330         A$=A$+CHR$(SCREEN(I,J+K))
  35. 340       NEXT K
  36. 350      IF RIGHT$(A$,3)<>"   " AND RIGHT$(A$,3)<>"TXT" THEN 370
  37. 360       N=N+1: D$(N)=A$
  38. 370      J=J+13
  39. 380      IF J>70 THEN J=1: I=I+1
  40. 390  WEND
  41. 400  PRINT "OK, now I must sort these into alphabetical order"
  42. 410  C=0 :S=0
  43. 420  ' START OF SHELL METZNER SORT
  44. 430  M=N
  45. 440  M=INT(M/2) :IF M=0 THEN 550
  46. 450  J=1 :K=N-M
  47. 460  I=J
  48. 470  L=I+M :C=C+1
  49. 480  IF D$(I) <=D$(L) THEN 520
  50. 490  SWAP D$(I),D$(L)
  51. 500  I=I-M
  52. 510  IF I>0 THEN 470
  53. 520  J=J+1
  54. 530  IF J>K THEN 440
  55. 540  GOTO 460
  56. 550  '
  57. 560  INDEX=1
  58. 570  CLS
  59. 580  FOR LCOUNT = 1 TO 20                'display 20 file names per screen
  60. 590     IF LCOUNT=1 THEN CLS:PRINT "File","Description":PRINT"========","=============================="
  61. 600     OPEN D$(INDEX) FOR INPUT AS #1   'open the Wordstar text file
  62. 610     LINE INPUT #1,A$                 'read the description line
  63. 620      IF LEFT$(A$,2)<>".." THEN A$="No Name present in file" ELSE A$=RIGHT$(A$,LEN(A$)-INSTR(A$," "))                 'supply a default description if none
  64. 630     PRINT D$(INDEX),A$
  65. 640     CLOSE #1
  66. 650     INDEX = INDEX + 1                'point to next file
  67. 660     IF INDEX>N THEN GOTO 690         'exit loop when done
  68. 670     NEXT LCOUNT
  69. 680  PRINT "PRESS [Esc] TO STOP, ANY OTHER KEY TO CONTINUE";:IF ASC(INPUT$(1))<>27 THEN GOTO 570
  70. 690  SYSTEM                              ' return to Wordstar
  71.